<template>
  <div>
    <div class="header">
      <van-nav-bar
        class="app-nav-bar"
        left-text="返回"
        left-arrow
        @click-left="$router.go(-1)"
      >
        <template #right>
          <van-icon name="ellipsis" />
        </template>
      </van-nav-bar>
    </div>
    <div class="main">
      <h2>{{article.title}}</h2>
      <div v-html="article.content"></div>
    </div>
  </div>
</template>

<script>
import {getArticle} from '@/api/new'
export default {
  data() {
    return {
      article:{}
    };
  },
  methods: {
    loadArticle(){
      getArticle(this.$route.params.id).then(res=>{
        console.log(res.data)
        this.article = res.data.data
      })
    }
  },
  created() {
    console.log(this.$route.params);
    this.loadArticle()
  },
};
</script>